/*******************************************************************************
// Global Declarations
*******************************************************************************/

enum {
    ID_FRAME = 10000,
    ID_PANEL,
    IDM_FILE_OPEN,
    IDM_FILE_SAVE,
    IDM_FILE_EXIT,
    IDM_HELP_HELP,
    IDM_HELP_ABOUT
};

/*******************************************************************************
// SDLPanel Class
*******************************************************************************/
    
class SDLPanel : public wxPanel {
    
public:
    /**
     * Creates a new SDLPanel.
     *
     * @param parent The wxWindow parent.
     */
    SDLPanel(wxWindow *parent);
    
    /**
     * Destructs this SDLPanel.
     */
    ~SDLPanel();
        
private:
    
    DECLARE_CLASS(SDLPanel)
    DECLARE_EVENT_TABLE()
    
    void onMouse(wxMouseEvent& event);
    void onKey(wxKeyEvent& event);

    /**
     * Called to paint the panel.
     *
     * @param event The triggering wxPaintEvent (unused).
     */
    void onPaint(wxPaintEvent &event);
    
    /**
     * Called to erase the background.
     *
     * @param event The triggering wxEraseEvent (unused).
     */
    void onEraseBackground(wxEraseEvent &event);
    
    /**
     * Called to update the panel.
     *
     * @param event The triggering wxIdleEvent (unused).
     */
    void onIdle(wxIdleEvent &event);
       
};

/*******************************************************************************
// SDLFrame Class
*******************************************************************************/

class SDLFrame : public wxFrame {
    
public:
    /**
     * Creates a new SDLFrame.
     */
    SDLFrame();
    
    /**
     * Gets the SDLPanel within this SDLFrame.
     *
     * @return The SDLPanel.
     */
    SDLPanel &getPanel();
    
private:
    
    DECLARE_CLASS(SDLFrame)
    DECLARE_EVENT_TABLE()

    SDLPanel *panel;
    
    /**
     * Called when exit from the file menu is selected.
     *
     * @param event The associated wxCommandEvent (unused).
     */
    void onFileOpen(wxCommandEvent &event);
    void onFileSave(wxCommandEvent &event);
    void onFileExit(wxCommandEvent &event);
    
    /**
     * Called when about from the help menu is selected.
     *
     * @param event The associated wxCommandEvent (unused).
     */
    void onHelpHelp(wxCommandEvent &event);
    void onHelpAbout(wxCommandEvent &event);
    
};

/*******************************************************************************
// SDLApp Class
*******************************************************************************/

class SDLApp : public wxApp {
    
public:
    /**
     * Called to initialize this SDLApp.
     *
     * @return true if initialization succeeded; false otherwise.
     */
    bool OnInit();
    
    /**
     * Called to run this SDLApp.
     *
     * @return The status code (0 if good, non-0 if bad).
     */
    int OnRun();
    
    /**
     * Called when this SDLApp is ready to exit.
     *
     * @return The exit code.
     */
    int OnExit();
    
private:
    DECLARE_CLASS(SDLApp)
    
    SDLFrame *frame;
};
